refactored some of cmd_hash