Added more commenting and a minified version.