Added validateNumeric function and improved validating