refactored Lambda to isolate subroutine creation