Fix parenting not working

In commit #21 ("Improvements made during LD 30"), I accidentally mixed
up some variables, which resulted in parenting being completely broken.
This commit addresses that issue by restoring the previous code.