Various cleanings & minor fix (xapi.js).