replaced magic constants with defines, changed the interrupt setup code trying to generalize a bit.