adding methods to minmaxelements to reduce complexity