Updated to refactored code