Add final NMDS code