Some refectoring.
Adding check for unsaved expressions on exit.