range methods now return smartpointers instead of raw pointers; internally also smartpointers are used