Get rid of some unused code
Remove some unused code and add comments
Compare 'max' values as well as 'min'