Refactor repositories a bit.