hard refactoring and creation of gem