Added changes for background mode execution.