Migrated controller.js to main.js