a bit more of transformation to declarative style