Adding the script with the first part of the solution