Pruned some obsolete code. Tidy up a little too...