Added GUI and fixed some bugs