included <algorithm> to make sure all compilers find std::max 

can't compile on VS 2013 preview otherwise.