Add support for original bg in dump
Refactoring