adding validation function: TODO test these