generate context helper