Chemical modification of a polymer