changed mainRoute to account for undefined params, removed obsolete variable