Updated Error Handling