Revert "Refactor into a class"

This reverts commit 9583f090a80236db36c2860a80fda092dd5f453c.