generalizes for node callback style functions