switched closures to named functions, added data