Encapsulate global variables

Make sure _version and _debug are not global variables
Merge pull request #1 from littlepea/master

Encapsulate global variables