Added circular dependency detection and static methods for dealing with output