Refactor to Gem