without global variables