Replaced parseInt with Math.round.