added normalization to compression loop