this should have been already moved
first steps towards a ffi interface