Adding profile middleware