Kinda solution for the Problem #2.