You are right, it doesn't matter much indeed if we do it before the beginning or after the end. It's probably better to do it inside of the layout algorithm this way the callsite doesn't have to care and possibly introduce bugs. 