cleaned up login, logout and cookie handling