Convert contact variables to cmi

Issue #217