1st draft of error handling