logoff method added with comments