changed api from c++ to c

1 day of work and painful debugging, heuristic now works with the c api