depend less on global state
Merge pull request #5 from LinusU/patch-1

depend less on global state