Tweaked code; added sample output.