created scheme. imported original c version.