Handle variable scope resonably, closes #48