First shot at Apache integration and a few small fixes