Restructuring and cmake build system