Move repeated operations into one section