Refactor Command and Message.