Updated after adding priority func() support