Minor re-org of main.js: assignments, init calls, event handlers

Signed-off-by: Rick Waldron <waldron.rick@gmail.com>