Random refactoring of lib/core.js
Merge commit '04903f2'

Conflicts:
	lib/core.js