Tidied up early code, (mostly comments, minor bug fixes)