cleanup of main