Rewrite solution for 1.02.
Tests for 1.03.