Refactor to move parsing to core script