adds closure to one of my functions