Koalecse middlware refactor.