validation code redesign