Added code for sorting entities by size