replace static functions with lambda