Refactoring some code in validation failed rules setup.