changed global to static variable