move helpers into closures