search function implemented // minor bugs fixed