Code cleanup

Replace old for loops with C++11 range-based for loops
Remove STL container clear() calls in constructors/destructors