Reduce raw exception throwing

Also fix some embarassing undefined names