Refactored the validate numbers functions