added bootloader
clean up code a bit (at the expense of size)