minor cleanup, exception handling