Refactored nc.py