Major bug fixing session, added data invariants