added SortedIterator and some changes on 2 files