lots of stdio, broken code