Moved gui code out of core