alert() calls added for debugging purposes in main.js