Updated code to match tutorial changes/feedback.