change this one to use joins instead of in