refactor pivot methods.