Almost done reintegration

Bugs: infiniteloop
pretty serious
fix it pls