Split functions into files by function area

Should make it far easier to change individual device functions.