fix terminal height calculation
add penetrate code (not used)