Added some minimal error handling