adding pivot functionality