include <algorithm> for std::min and std::max in VS2013