Another big performance jump by using arraylists rather than sets