much better checking of data