added devise and switched header code