Refactor and add mathcheck

Module ```utils``` is not being used.