added if check to check for command before checking it's key length