Exception handling, minor improvements, etc