Lots of older changes, some of which I forget :(
Fixed merge issues