Settlement generation code working