fixes #31 remove static functions from global scope and use private namespace