refactory of gui