synced with upstream
merged with upstream, resolved several merges, mostly opting for upstream code