Simple C implementation, parts tightly coupled.
