latest updates - still needs debugging