Avoid lambdas in order to support for older gcc versions