Refactored Code for new style