Minor refactoring: using instead of typedefs, replace some iterators with const ones.