Added modularity.
Added sanity check function to test formatting.