Refactor math tests and index.js