refactor word controller