refacor for Command pattern