Shashlik endcap algo

* Integrate Chris' development