Fixed script to be completely working for part a