terminal logic