extract function
check squareness, again
expand_bb function (not exported)