Optimization Release

Moved apache class definition from server side to module side and fixed
various relationship/ordering bugs