Major progress - seems to work now.