Merging updates from MH, with some fixes applied.