Added Michael's solution.