extract anonymous function to static method