Removed janky code that worked around the circular reference issue. The issue with duplicate database entries should be resolved now as well.