Turned the comparison script into a function

That's so it can be run multiple times.