Ensure params is also stored
Tidy up and deal with space on the end of the url