code clean-up in Main.js
Add custom classes of exceptions. Fixes #16