Added logout logic