add testSample.txt
rename register functions (e.g. registerFreeData -> registerFreeFn)
small code improvements