Refactor gem structure