Refactored code works.