read files as arraybuffers
significant reorginazation and improvement, needs cleanup but I'm hesitant to delete anything right now