Added isInputValid() to check input against regex and added validation for distance field