Refactor and add mathcheck

Remove ```Logical```?