Search functionality implemented and various bugs fixed