Add Leaf class to handle endpoint actions. Clean up names.