Fix for circular dependencies. Code is inefficient now