first version working. still no uncorr systs and still an annoying memory leak at the beginning (yet harmless)