moved middleware down further, but we need another solution if we want to move it back.