Rewrite as a function so it can call from main.

Printable View