change order of instructions to make more sense