Refactor apache into its own class