massive changes; implemented most of the format module