implemantation of join