script changes from Michael Goddard