Re-organized bootstrap and other minor refactoring