pass appropriate next function for each enqueue