Cached end iterator and some clean