fix for speeds other than 16Mhz, peripheral code cleanup, etc.