Mostly cosmetic changes to various file reading/writing functions for greater readibility.
Removed some superfluous calloc()/malloc() calls.