Cleaned up Error handling