refactor
resource amount check
sanitize dup command
sanitize illegal command target