Cleaned up avr implementation.