rearange code