there is basic error handling in this code