updated to work with new closure types