Enhanced C implementation of Carbon relay