Tidied up core MODE handling somewhat. More work to be done.