Refactored code to module.