Code fixups, in-depth walkthrough in core.js