Minor refactoring, more progress on the bootloader.