Various changes in order to cater for js-engine changes. Note the scripted test is now failing - investigating why.