code reordering and reformatting