Rewrote logic to use cursor position to determine word

Fixes #3 and #6
Merge pull request #11 from robhurring/use-cursor-position-instead-selection

Rewrote logic to use cursor position to determine word