intermediate state gui and some refactorings/structural changes