closures and manipulating data structures