Rearranged some code.