solves problem #50, added some helpers, refactoring to use these
helpers in other solutions.