first working version of getwords