completed script functionality