Rearranged and grouped code.