finish code cleanup, app was in a mostly complete but bad state