using global variables