Reworking the gui parts

Still not finished. Working on good gui integration.