Refactored code and added minified versions.