Update master with up-to-date code

Many changes were left out of master. This should resolve them.