implement and test toc and math