Split up into cli and a function