Added clean error handling