Import improvements from Lanli (and more things)