middleware structure upgraded