rewrote as4 to use built-in sets instead of my own shoddy implementation
rewrote as6 to use sets