replaced parseInt() by Math.round()