Constraint-based causal discovery with tiered background knowledge and latent variables in single or overlapping datasets