clean up
handle terminal