Removing duplicate command logic