refactored code
next_word now notifies callbacks