Adding optional callbacks to some functions