implemented bootstrapping, added some tests