More merging (this is going to need some serious cleanup afterwards).