fisnished basic history functions
cleaned up some code