converted it to use sets