Fixed the rounding method. Added error messages