Added/clarified comments. Tidied up a bit.