refactored code.. removed single and added search