change join algorithm and add util package