Removes use of global var (fixes #110)