added to proper part of middleware