simplify and finish static middleware