cbegin/cend is c++14. switched to begin/end