Got stage 1 of 8 partially working. It wont work for more complex scenarios, but it currently passes my tests.