add external sorting