separated normalization into its own function