Added a full implementation of the pivot tables - still couple of things to do left...