replaced member functions begin and end with non-member functions