Fixed search and made cleaner