wip: gui code refactor, buggy