Callback implementation with closures.