Refactor gem.