Merge all changes from Sudar's fork into upstream