#6: renames variables, adds comments
#6: fixes a fatal error that could not detect circular dependencies;
#6: fixes a fatal error that causes async throw
fixes #6: adds test cases for circular detection