created lambda function declaration to be reused