State querying working but it is very slow

Added looping through states and scaling size of state links but adding
entries to the database is very slow