Improved class NS-stripping code