refactored gem