refactoring of numhstore c sources

- removed code duplications
- inlined one liners
- restructured code organisation