trying to clean error handling