Improved algorithm for pie size allocation