Refactor: no globals used, only one singleton