Made Main more robust and not crashing whenever something is wrong or missing