Encapsulate global variables

Make sure _version and _debug are not global variables