Implemented searching algorithm