splitting up into cli and server parts