Refactoring to a gem structure