Replace repeating commands with arrays