refactor words factory to use ngResource