almost finished search functionality but needs clean up