Mk c api

Preliminary changes for a C-API