Move to module pattern for JavaScript files