Restructured code in order to build the app as a SPA