Rewrote logic to use cursor position to determine word

Fixes #3 and #6