wrapped some lambdas in their own functions for clarity