Add autoload cookies and improve case expression