Improving support for circular dependencies

Signed-off-by: Phil Mander <philip.mander@gmail.com>