Fixed bug when restarting. Few minor changes.