Finished adding error handling