Convert enqueue_object to a function