F69: Refactor terminal programm for better errors catching.