add datastructure validity checks