edit parent centering code for efficiency