refactored part of solution to lesson2prob3..recursive instead of 'while True'