Some scala code from coursera