Remove duplicates from wordlist and speed up stats queries

Specifically got rid of the "select distinct" bits.