remove redundant code and add autoload cookies.