Refactor label positions calculation to separate methods.