cleaning up SPA code