Initial refactoring to support non appserver oriented stacks.