Added gui logic