refactor element stripping code, add in sig stripping too