More API implementation, some debugging functions...