first \"working\" c version