added checks for joins and stuff