Reorganized code layout