created a second, simplier implementation