REFACTOR: Refactored code to support minification and make it more consistent.