Clean up of init_terminal