Removed unneeded variables and fixed script to use proper variables