refactor findHazards()