moved static vars out of function body