finished all the init routines, mostly copied from the trials