implemented circular dependency check + unit testing