all the changes to make this version of shadow generation correct