Moved stop command into endProgram()