Remove whitespace & refactor search