change ArrayList to HashSet to improve '.contains' performance