added bound checking to harmonization
tweaked harmonization