Refactored & simplified code for searching tracks