refactor callback to lambda
use g++ instead of clang for linuxes