Move globals to file
Make comparisons free functions