Unified implementation of _replicate and _replicate_filter, now they work for any depth of relations. Fixed docstrings.
merge