Refactoring and single word search implemented