started on refactoring to gem