proper implementation using the closure properties