Trying validation according to pseudocode