Issue #30 v2

On the basis of code from ```Issue_#57``` I've made the second version of solution this issue. Now we can choose whose solution.