Extract waiting for item to be ready into a utility function