add nn() function, some docstrings

Solves half of #2.