switch to lambda expressions wherever possible