Rearranged logic.