implementation of searching