updated code to work with interrupts, added transmit funcationality, cleaned up old code