Reorganized code structure