updated with middleware changes