Move some operations from run to utils