Refactoring. Moved constants out into configuration objects. Broke logic into modules.