Merge latest code directly from upstream