add logout procedure, arcane persistence code for cookie, remember me checkbox