The final solution can be found HERE