Refactor and add mathcheck

No: It's used in print_extra_information.