Restructured the main source tree and update the build system