outsourced and adjusted "normalize"
fixes & adjustments