Also adding range checks to all places where it gets used. This is from CON code so proper values are never guaranteed.