More logging

Please note that I didn't do *any* tidy-up for this code to meet code conventions. We'll do the whole project in one go at a later date.