use Map::entrySet
update option checks
update tools/leak-check.rb
refactor CMakeLists.txt