refactory command and event design.