Added r.js and fixed some minor bugs within the demo page