Split some functions into utils