move ncpu as global
caching system to speed up writing
speeding up writing
fixing bux in getvalueiter
remove debug
cleaned output