Improve data normalization code