Revert changes to Mainfunction