exception handling changes, and optimized variable names, Fixes#219