factoring out the horrible circular dependency