code refactorings, more use of STL