working script for last part of assignment 3