changed to lambda function mechanism
switched to lambda functions