refactored code in SearchTitleAcivity