initial release.
reduce memory usage by using inplace sorting.