Completed skeleton of triplet_handler code