Add in better error handling