Added complete functionality to GuiEvents and fixed some bugs