Refactor toa5 comparisons on upload to improve performance