split cli code and server code