Refactored/restructured code.