added basic bootstrapping and fixed many bugs