Cleanup and filter the header scripts.