almost working, too much ram usage tho