[wip] Add createMainContext method

Work in progress.