added functionality that allows users to change word with click