Added UnitCompare function to unit.c