sorted lists of files/includes alphabetically
cleaned up resource buf interface. Added some basic templating to eliminate need for separate mat_buff