Moved commands from each function into generic command function to save some typing