Refactored CustomSqlValidationHandler. Some tests are failing now. refs #454