Completed script for assignment2