Also including changes from master's bc36ca871bb895a8e0374b41f4f357d68a0869f0