Added logout handling