Reorganized code for compilation and execution.