adjusting a type to prevent precision loss
using lambda's to access the standard sorting function

By using lambda's, I will be able to dispense with certain other
functions and rely upon the standard C++ library for sorting routines.
This should make the code easier to understand and verify is correct.