The minOrNull and maxOrNull functions