replacing the gcc-ism and making the lambdas static