[The code's too big to put in this message I'm going to try putting it in a separate message]
Which Arduino are you running this on? The 328-based Arduinos have 2K of SRAM. The SD library needs 1/4 of that for the buffer to read from/write to the SD card.
Aside from the code being less elegant and hogging memory do you think that is actually part of the execution problem?