More work on the repository layer.