updated nn.cpp