Fix error reports (use new Error) and improve error messages
Fix typos
Improve the if/else if/else stack transformation