modified to smaller bootstrap code