Refactoring of validation module