added cookie jar code; need to debug for runtime erros