Implemented receiveCommand and updateState