Cleans up and annotates rekapi.core.js a bit.