Refactor gems