Moved external functions to utils.