Restructure source code