Implemented search function

Might still be buggy