Refactor, optimize for minification