Basics of ncd now work

need to fix wait timer to be reasonable instead of sleep
add documentation
clean up code
modularize
add better documentation