added endian support to file parsing