Reordered to provide search
Added check for blank search query.

This should be impossible but if it does happen it will crash