added nntrain code, added opts object