Submitted refactored code.