Add some generic infrastructure. Comments welcome