cleaned up and fixed rounding