Working solve. Very slow at this point.