refactored attributes_for_search method