Added a number of utilities and some basic error handling