search now words on all input. fixed todo and cleaned up code