solution to kata-4 (working progress)