some mistakes; double check
main rename and whatnot. 10s runtime with -O