implemented two key sort