Restructure engine source code (part 1) (#10923)