Updated UI and fixed flag checking code.