added instructions, tidied up code
background