Moved this out from CreateCommand.