lots of bugfixes, and changing to SAN algebriac display