changed rounding logic to round instead of trunc