implement stack to make it possible to set a max size of history entries and ad unit tests