Changed int type to unsigned so std::max works.