Refactored, added global variable, used deepcopy() instead of copy() - reference issue