minimam optimize
add middleware