slight changes to ordering of commands in script