fleshed out some of the cookie jar code added comments