Tidied up code base. No logic changes, although some cout and Debug::log() messages were removed.