Refactor the library

Use a Client class to persist state (logged in cookies).