move declarations to the top, and declare the hash tables