Split IR and basic movement functions into util.h