revamp cookie handling. use cookie jar.