Pass cookie through programmatic API

fixes #41
closes #92
improvements to #92