Restart function added, still needs improvement.
Merged