run_in_context passes ctx as parameter
move create_nested_context out of ctx