(1) A few style changes. (2) Added fclose to a function that used fopen without closing the resource later on.

TODO: This class needs a major clean-up.