implement first solution (prototype-style)