Move ReadCommand into WriteCommand. Fix some errors