use erlang pretty print
factor out stdin code
cleanup