some refactoring (WARN: NIH.coffee is depracated!)