changed ctree to use a table and fixed mare count