almost done. Rewrite program.