Finishing assignment week 4, but still testing (slooow)
Submitted. Has a problem with infinite loop. Added a test but unable to isolate.