completed script, but untested