replaced global variables