Code cleanup, logout log fix