refactored data transformations, added reconstruction functions