some cleanup and building some hashes