Handle simulations + refactor main.cpp