Refactor reusable stuff into its own class