Problem 4 (Ugly solution)