Added code for minmax stat functions.