You could probably put this code into a function, since you repeat it for each arm.