Fixed the sizing algorithm