Started search function and fixed bug in creating