using some normalization code from the web