Added comments to ported codes