fix whitespace and move search into separate file