triangle and some cleanup