added code from xdo project to start implementing new SPA architecture