rearrange code into a sensical fashion