more work on api, working on fixing the internal functions