Add logout and save functionality