cleanup of nn.py