Improve validators in C