Factor out comparray