Can you refactor calculateIFDLength() so that it returns both the IFD and the data section lengths? Returning an array might be faster and cleaner than looping through the metadata twice.