updated search logic to work with attributes