basic working program.  It's pretty ugly