Refactor and add mathcheck

It can be rewritten using the object syntax.
```
print(("Crashed generating properties on run %s."):format(i))
```
I think we tend to prefer this syntax over ```string.format``` but I checked the pflua codebase and we use both the exact number of times. I don't have a strong opinion about this. Use what you think is more readable.