Finished normalization code