this method turned out to be really nice. The code is easy to follow.