moved static functions into anonymous namespace