Added code with minimal example from NEF algorithm page