modified context functions slightly to get ready for #27"