Simplify `get_pivot'

This implementation is faster than the previous one in most cases.