Rearranged logic