Jeremie Allard's solution:
Solution