switch to exceptions package for better handling of exceptions