Code from meteor.js JavaScript primer