added comments, ensured History object is the only thing that ends up in global scope