pass global Elements and related fixes
Merge pull request #50 from WriteOrRead/refactor

pass global Elements and related fixes