Also including changes from master's 476576bb8f94c740aa6f587b8c9168bb7959644b