some more tweaking
scripted update of code from master at ee9a79b some more tweaking