Code Cleanup

- Made code more compact and consistent while reviewing sorting for UDAs.