Updated spawnTerminal() code