Fixing bug in search
Cleaning code