Minor fixes (code tidy up), ready to upload this block into the Moodle Plugins Directory