optimize renderCommands