Cleaned up pivot source code: reordered private functions and replaced inline constants with private static ones.