Refactored HttpModule - this is now fully self-contained.