rewrite createCal function. close #7