Use lambda functions. close #228