added ISort base class & fixed some bugs