Abstract command creation into a separate method