added simple tests, fixing globals