Restructured the source code