Old manually coded version.