Fix/merge release 4 0 into dev

Because of the conflicts I had to resolve, I want to run this through travis before merging.