preparing C version wip