converting to pure AVR code