Almost done.  I should clean up the code