REFACTOR to not use global variables