better to handle the error and return first, and then the main code doesn't need to be indented