updated search algorithm to work with extra types