rename client to command
move some functions to new files