Added automated references to repository objects. Makes most of the code cleaner.