adding half-done c version