I have no idea what I'm doing ;)

Hopefully this PR works. I've never had to send somebody a PR in the reverse direction before! ;) I pretty much just copied and pasted your existing code into a class and split it into methods. I think if more options get added, it would make sense to split each option into its own class, strategy style.