Replaced C++11 feature for (auto element : list) by iterators since the Ubuntu 10.04 compiler doesn't like this feature.