problem2 with a closure