added view and auth middleware