updated to calculate size