Adding comments to explain the problem and implementation.