Added support for global variables

Fixes #46