Refactored some code, fixes to minifier, and performance improvements to encoder