rearrange code of solution code