fixed tracking issues and retained used of history
added boundary test