Fix nested conditionals in Search. Cleaned up extraneous code.