Changed min() call to reduce possibility of rounding error returning a