yielding and validation function