makes done accept a function and call it