added helper functions and processing via lambdas