Submission is working. Refactoring math expression generation