modifying terminal logic