Move CIP conversion code to lib, add tests.