Fixxed compiler errors and fixxed most issues with 1D emd working with 2D data structures.