polluted code with comments to explain the obvious :)