remove unused stuff and finish up to a reasonable degree