working validation

(TODO: null/not null propagation, mitigate StackOverflow)