[WIP] Patched existing PR to fix conflicts.