Move some functions from core to util