Removed intermediate print statements
Replaced z[d] with score