added comments to generic implementation