fix syntax errors, use lambda