Fully support nls

A lot of work - the first step into a good nls