Break calendar.js into more functions