Solutions for the coursera homework