Complete Ch8 Medium Challenge