added tests, updated chain and stringutil