better sizing algorithm