Updates to better handle error cases