refactoring of nbmanager and filenbmanager

major clean up of the two managers. We make sure to follow
the standard models described in IPEP 16