Refactored the API declaration and implementation of the pivot function for clearer and simpler use and maintenance.
Also simplified the implementations of the helper functions.
Refactored the API declaration and implementation of the pivot function for clearer and simpler use and maintenance.
Also simplified the implementations of the helper functions.