You might think of looking at it from 2 different points:
1. What you want to get rid (current method)
2. What you want to keep (ie search for the number in the line)
Often if you get stuck looking at it from only one point of view you may miss an easier alternative