implemented an untested version of libapi