updated error handling
more style updates