add flag to optionally apply joins