refactored code to origin