main.js - Minor function & var hoisting optimizations. No functional changes