refactor gem structure