Refactor function object using for comprehensions