improved merging with support for nested includes