updated script to include history.  still not 100%