Validated code and added links
tidied up code