restructure source code