smart gui code