second version with lambdaj and magic