major revisions to code, pass hashes instead