Implemented better tracing and logging for the repository.
Also cleaned up some mess left over from the previous Event/AR prototyping.