did a bit of error handling