Completed script. V1.0