update sanity checks
moved some functions