place middleware components in the right order