Refactor finalizeSize to make it more compressor friendly.