Compiles on recent versions of avr-gcc & multiple sleep bugfixes

Thought these changes might interest you.  See the individual commit comments for details.