Move file parsing functions to math module, for easier re-using