Make code more modular handle more commands