fixed some gui stuff, added state events