Merged main.cpp and main_spreadout.cpp