Basic error handling implemented