update readme, and tidy up the code a bit