Added some debugging statements to api and demand, fixed some minor bugs in api, we now parse unicode properly