Use STL algorithms more often